
function toggleHistory() {
	var history = $('history');
	var toggler = $('history_toggler');

	if(toggler.firstChild.nodeValue == 'show') {
		toggler.firstChild.nodeValue = 'hide';
		history.setStyle('display', '');
	}
	else {
		toggler.firstChild.nodeValue = 'show';
		history.setStyle('display', 'none');
	}
}

function editPreview(content, update) {
	return new Ajax(
		'?preview',
		{
			method: 'post',
			postBody: Object.toQueryString({content: content}),
			update: update
		}
	).request();
}

function editSubmitted(form) {
	$A(form.elements).filter(function(e) {
		return e.type && e.type.toLowerCase() == 'submit';
	}).forEach(function(submitButton) {
		submitButton.disabled = true;
	});
}